﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media.Animation;

namespace GGSim
{
    public class GameControl
    {
        internal GG.Base.IsoGridView isoGrid;
        public GameControl(GG.Base.IsoGridView isoGrid)
        {
            this.isoGrid = isoGrid;
            System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(10);
            timer.Tick += new EventHandler(MainGameLoop);
            timer.Start();


            Car car = new Car();
            isoGrid.AddGridDrawable(car);
            //car.Speed = new Point(0,10);
            //car.Rotation = 45;

            Block block = new Block();
            isoGrid.AddGridDrawable(block);
            block.Position = new System.Windows.Point(512,512);
            

        }


        void MainGameLoop(object sender, EventArgs e)
        {
            foreach (GG.Base.INeedToGetSomeUpdates drawable in isoGrid.GridObjects.OfType<GG.Base.INeedToGetSomeUpdates>())
            {
                drawable.WhatImGoingToDoWhenIUpdate();
            }
        }
    }
}
